Repository navigation
Conversation
Contributor
✅ Verify Test Reproduction: Tests FAILED without the fix (expected)This confirms the changed tests correctly reproduce the bug that the source changes fix. This workflow runs the changed tests without the source fix to verify they reproduce the bug. Show output |
pubkey
force-pushed
the
claude/vigilant-newton-8rqsab-close-collection-of-failed-or-interrupted-add-collections
branch
2 times, most recently
from
November 13, 2026 12:55
4af0961 to
6ff9cff
Compare
… call A collection that was created by addCollections() but never reached database.collections was not closed when its creation failed (for example DM4 from the autoMigrate migration) or when database.close() was called while the automatic migration was still running. Its timeouts, like the 60 seconds wait of the cleanup plugin, kept the process alive. createRxCollection() now closes the collection when the creation fails and database.close() also closes the collections of this database that are still being created. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015P6w6hnnyVPXwotts6YQ2F
pubkey
force-pushed
the
claude/vigilant-newton-8rqsab-close-collection-of-failed-or-interrupted-add-collections
branch
from
November 14, 2026 13:20
6ff9cff to
b2c5fbe
Compare
close() collected the collections from OPEN_COLLECTIONS and from this.collections. A normal collection is in both, so its close() ran twice in the same tick and the onClose handlers ran twice. The GraphQL replication then released its websocket reference twice and threw "missing value from map ws://..." as an unhandled rejection. Both lists are now merged into a Set so that each collection is closed once. The test 'should close the collection when the database is closed during the automatic migration' awaited database.close() before it released the migration strategy. Since #9661 closing waits for the running batch of the canceled migration, so the test never ended. It now releases the strategy after the migration was canceled and then awaits the close. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015P6w6hnnyVPXwotts6YQ2F
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains:
Describe the problem you have without this PR
a collection that was created by an
addCollections()call which failed (for example withDM4from theautoMigratemigration) or which was still running whendatabase.close()was called, was never closed, so its timeouts (like the 60 seconds wait of the cleanup plugin) kept the JavaScript process aliveWhen the creation of a collection failed after the collection object existed, only the storage instance was closed. The collection stayed open with the timers that plugins start for it, and the 60 second timer of the cleanup plugin kept the process alive. The same happened when
database.close()ran whileaddCollections()waited for an automatic migration, because the collection was not registered in the database yet. A failed creation now closes the collection, anddatabase.close()also closes the collections of the database that are still being created.EmptyErroron Dexie and localStorage, and the call stays pending on memory. pubkey/rxdb#9565 fixes that withDM8. Both together giveDM8, a process that exits, and no unhandled rejection.CLOSEDevent oncollections$for a collection that was never added.database.close()while the collection is still being prepared.Changed files:
orga/changelog/fix-close-collection-of-failed-or-interrupted-add-collections.jsonsrc/rx-collection.tssrc/rx-database.tstest/unit/migration-schema.test.tsTest output without the fix
The changed test file run on the memory storage with
src/frommaster:Test output with the fix
Todos
Assisted by
YES, CLAUDE CODE
Generated by Claude Code